[tablet, queryrules] Extend query rules to check comments#8233
Merged
ajm188 merged 2 commits intovitessio:mainfrom Jul 22, 2021
Merged
[tablet, queryrules] Extend query rules to check comments#8233ajm188 merged 2 commits intovitessio:mainfrom
ajm188 merged 2 commits intovitessio:mainfrom
Conversation
Member
harshit-gangal
left a comment
There was a problem hiding this comment.
overall looks good. added some comments.
…nt merge. Signed-off-by: falun <635538+falun@users.noreply.github.com>
Signed-off-by: falun <635538+falun@users.noreply.github.com>
harshit-gangal
approved these changes
Jun 9, 2021
Comment on lines
108
to
+115
| if *fileRulePath != "" { | ||
| qsc.RegisterQueryRuleSource(FileCustomRuleSource) | ||
| fileCustomRule.Open(qsc, *fileRulePath) | ||
|
|
||
| if !*fileRuleShouldWatch { | ||
| return | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
nit: same change could be made for fileRulePath as was done for fileRuleShouldWatch
ajm188
pushed a commit
to tinyspeck/vitess
that referenced
this pull request
Jul 22, 2021
[tablet, queryrules] Extend query rules to check comments Signed-off-by: Andrew Mason <amason@slack-corp.com>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR makes three changes
fsnotifyto watch for changes vs the rules filerulesctlDetails: Watching the file
We use fsnotify which seems to be the generally accepted approach. There are some gymnastics necessary as watching the specific file is prone to losing track of it in the event that the file is deleted+recreated. To handle this case we watch the directory containing the file and react only when the node we receive events for matches the file we are watching.
Details: Filtering on MarginComments
This was mostly plumbing within the
Ruleitself + the application callstack as thetabletserver/query_executor::QueryExecutorhas already baked margin comments into it during the initial phase of the Execute call.Evaluation is similar to but not the same as the Query regexp because that is stable across query shapes (otherwise it wouldn't be the same query). For margin comments we need to defer evaluation until after the plan cache which is why Query & comments take different paths.
Test failures
The only listed failure is
endtoend/tabletmanager/tablegcwhich seems unlikely to be related afaict.Related Issue(s)
n/a
Checklist
Deployment Notes
No changes necessary for existing deployments.
Impacted Areas in Vitess
Components that this PR will affect: